package edu.zut.cs.javaee.dream.product.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import edu.zut.cs.javaee.dream.base.domain.BaseEntity;

/**
 * entity class for product
 * 
 * @author liuxiaoming
 *
 */
@Entity
@Table(name = "T_PRODUCT")
public class Product extends BaseEntity<Long> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3199029100807028476L;

	/**
	 * name for product
	 */
	@Column
	String name;

	/**
	 * code for product
	 */
	@Column
	String code;

	/**
	 * Many product objects relate to one category of product.
	 */
	@ManyToOne
	@JoinColumn(name = "PRODUCT_CATEGORY_ID")
	ProductCategory productCategory;

	public ProductCategory getProductCategory() {
		return productCategory;
	}

	public void setProductCategory(ProductCategory productCategory) {
		this.productCategory = productCategory;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

}
